package com.bicon.botu.mall.order.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class AfterSalesExportDto {

    /**
     * 售后ID
     */
    private String afterSalesId;
    /**
     * 售后编号
     */
    private String afterSalesNo;
    /**
     * 顾客
     */
    private String customerAccount;
    /**
     * 退款金额
     */
    private String payBackAmount;
    /**
     * 是否退运费
     */
    private Boolean payBackFreight;
    /**
     * 原订单编号
     */
    private String orderGoodsNo;
    /**
     * 售后状态
     */
    private Integer status;
    /**
     * 类型
     */
    private Integer type;
    /**
     * 申请日期
     */
    private Date applyTime;
    /**
     * 处理日期
     */
    private Date processTime;
    /**
     * 原因
     */
    private String reason;
    /**
     * 描述
     */
    private String description;
    /**
     * 凭证图1
     */
    private List<String> images;
    /**
     * 收件人
     */
    private String deliveryShipper;
    /**
     * 收件人电话
     */
    private String deliveryTelephone;
    /**
     * 退货地址
     */
    private String deliveryAddress;
    /**
     * 商品编号
     */
    private String productCode;
    /**
     * 商品名称
     */
    private String goodsName;
    /**
     * 单价
     */
    private BigDecimal platformPrice;
    /**
     * 退数量
     */
    private Integer goodsNumber;
    /**
     * 物流公司
     */
    private String logisticsCompanyName;
    /**
     * 物流单号
     */
    private String logisticsCode;
    /**
     * 备注
     */
    private String logisticsDescription;
    /**
     * 拒绝理由
     */
    private String rejectReason;

    public String parsePayBackFreight() {
        return this.payBackFreight ? "退运费" : "不退运费";
    }

    public String parseStatus() {
        switch (this.status) {
            case 1:
                return "待处理";
            case 2:
                return "处理中";
            case 3:
                return "处理中";
            case 4:
                return "处理中";
            case 5:
                return "已退款";
            case 6:
                return "已拒绝";
            case 7:
                return "已撤销";
            default:
                return "";
        }
    }

    public String parseType(){
        return this.type==1?"仅退款":"退货退款";
    }

    public String getImages(int index ){
        if(this.images!=null&&this.images.size()>=index){
            return this.images.get(index-1);
        }
        return "";
    }
}
